package com.fadadianqi.logistics.admin.net;

import org.springframework.context.ApplicationContext;


public class SpringUtils {
    public static Object getBean(String beanID) {
        /*WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();
		ApplicationContext acx = null;
		return wac.getBean(beanID);*/
        return getApplicationContext().getBean(beanID);
    }

    private static ApplicationContext ctx;

    /**
     * Injected from the class "ApplicationContextProvider" which is
     * automatically
     * <p/>
     * loaded during Spring-Initialization.
     */

    public static void setApplicationContext(
            ApplicationContext applicationContext) {
        ctx = applicationContext;

    }

    /**
     * Get access to the Spring ApplicationContext from everywhere in your
     * Application.
     *
     * @return
     */

    public static ApplicationContext getApplicationContext() {
        return ctx;

    }
}
